<template>


  <div>


    <el-row>
      <el-col :span="3">
        <el-form-item :label="$tt('label_pms_transport_route_filter')">

          <div style="display: flex;" class="product-line-limit-div">
            <div class="product-line-limit-col" style="width: 200px; margin-right: 12px;">{{$tt('label_pms_main_transport_type')}}</div>
            <div class="product-line-limit-col">{{$tt('label_pms_weight_range')}}</div>
            <div class="product-line-limit-col">{{$tt('label_pms_volume_range')}}</div>
            <div class="product-line-limit-col">{{$tt('label_pms_max_lengh')}}</div>
          </div>
          <div style="display: flex; line-height: 48px; " class="product-line-limit-div">

            <ex_super_input v-model="pmsTransportRule.mainType" type="select"
                            enum="LogisticsProductsTypeEnum"
                            style="width: 200px; margin-right: 12px; "></ex_super_input>

            <div class="product-line-limit-col" style=" display: flex;">
              <el-input placeholder="0kg" v-model="pmsTransportRule.minWeight"></el-input>
              <div style="padding: 0px 4px;">{{$tt('label_link')}}</div>
              <el-input placeholder="99999kg" v-model="pmsTransportRule.maxWeight"></el-input>
            </div>

            <div class="product-line-limit-col" style=" display: flex;">
              <el-input placeholder="0 cbm" v-model="pmsTransportRule.minVolume"></el-input>
              <div style="padding: 0px 4px;">{{$tt('label_link')}}</div>
              <el-input placeholder="99999 cbm" v-model="pmsTransportRule.maxVolume"></el-input>
            </div>

            <div class="product-line-limit-col">
              <el-input v-model="pmsTransportRule.maxBorder"></el-input>
            </div>

          </div>

        </el-form-item>
      </el-col>
    </el-row>

    <el-row>
      <el-col :span="3">

        <el-form-item :label="$tt('label_pms_transport_route_ref')">

          <div class="product-line-limit-div-2">
            <div style="width: 40px;"></div>
            <div>{{ $tt('label_pms_transport_supply') }}</div>
            <div>{{$tt('label_pms_line_route')}}</div>
            <div></div>
          </div>

          <div style="display: flex;" class="product-line-limit-div-2" v-for="item,index, in routeArray">
            <div style="width: 40px;">
              <el-checkbox v-model="item.checked"></el-checkbox>
            </div>
            <div>
              {{item.supplyName}}
            </div>
            <div>
              {{item.ownerType == 'THIRD'? item.lineName : item.lineName + ' - ' + item.routeName }}
            </div>
            <div>
              {{item.ownerType == 'THIRD' ? $tt('label_pms_third') : $tt('label_pms_own') }}
            </div>
          </div>

        </el-form-item>

      </el-col>
    </el-row>

  </div>

</template>


<script>

  import Vue from 'vue'

  export default {
    name: 'warehouse_select',
    data() {
      return {
        pmsTransportRule: {
          'mainType': 'LORRY_NAVIGATE',
          'maxBorder': '',
          'maxVolume': '',
          'maxWeight': '',
          'minVolume': '',
          'minWeight': '',
          'ruleType': ''
        },

        routeArray: [],

        lastQueryParam:{}
      }
    },

    watch: {
      value: function (val, old) {

        if (val) {
          this.pmsTransportRule = this.value
        } else {
          this.pmsTransportRule = {}
        }

      },
      'pmsTransportRule.mainType'(val, old){

      },
      'pmsTransportRule.maxBorder'(val, old){

      },
      'pmsTransportRule.maxVolume'(val, old){

      },
      'pmsTransportRule.maxWeight'(val, old){

      },
      'pmsTransportRule.minVolume'(val, old){

      },
      'pmsTransportRule.minWeight'(val, old){

      },
      'pmsTransportRule.ruleType'(val, old){

      },

    },

    props: {
      value: null,
    },

    created() {

      let _this = this

      if (this.value) {
        this.pmsTransportRule = this.value
      }

      if (_this.hasLoad) {
        return
      }

      // _this.$ajax({
      //   url: '/oms-api/base/OmsBaseWarehouseRpc/selectAllEnable.json',
      //   success: function (res) {
      //     _this.hasLoad = true
      //
      //     res.data.rows.forEach(rr => {
      //       rr.id = rr.id + ''
      //       _this.optionMap[rr.id] = rr
      //     })
      //
      //     _this.options = res.data.rows
      //   }
      // })

    },

    methods: {

      refreshQuery(){

      }

    }
  }
</script>
